<!DOCTYPE html>
<html lang="en">

<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <!-- Meta, title, CSS, favicons, etc. -->
    <meta charset="utf-8">
    
    <meta name="viewport" content="width=device-width, initial-scale=1">

    <title>${_title}</title>

    <!-- Bootstrap core CSS -->

    <link href="${_css}/bootstrap.min.css" rel="stylesheet">

    <link href="${_css}/font-awesome.min.css" rel="stylesheet">
    <link href="${_css}/animate.min.css" rel="stylesheet">

    <!-- Custom styling plus plugins -->
    <link href="${_css}/custom.css" rel="stylesheet">
    <link href="${_css}/icheck/flat/green.css" rel="stylesheet">
    <link href="${_css}/datatables/tools/css/dataTables.tableTools.css" rel="stylesheet">
	<link rel="stylesheet" href="${_css}/base.css">
    <script src="${_js}/jquery.min.js"></script>
	<script src="${_js}/resize.js"></script>
	<script type="text/javascript" src="${_front_js}/jquery.page.js"></script>
    <!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries -->
    <!--[if lt IE 9]>
          <script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script>
          <script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
        <![endif]-->
	<style>
		td a{
			cursor:pointer
		}
	</style>
</head>


<body style="background: #F7F7F7;">
<div class="">
    <div class="row">
        <div class="col-md-12 col-sm-12 col-xs-12">
            <div class="x_panel">
                <div class="x_title">
                    <h2>债权转让列表</h2>
                    <div class="clearfix"></div>
                </div>
            </div>
            <div class="scroll">
                <div class="x_content">
                    <table id="example" data-action="/admin/borrow/change/list?1=1" class="table table-striped responsive-utilities jambo_table">
                        <thead>
                            <tr class="headings">
                                <th>
                                    <input type="checkbox" class="tableflat">
                                </th>
                                <th>序号 </th>
                                <th>转让编号</th>
                                <th>债权标题</th>
                                <th>转让用户</th>
                            	<th>转让后持有用户</th>
                                <th>转让状态</th>
                                <th>竞拍底价(￥)</th>
                                <th>转让金额(￥)</th>
                                <th>有效天数 </th>
                                <th>创建时间 </th>
                                <th>操作</th>
                            </tr>
                        </thead>

                        <tbody>
			                <#if (pageInfo.pageList?size > 0)>
								<#list pageInfo.pageList as model>
									<tr class="even pointer">
		                                <td class="a-center ">
		                                    <input type="checkbox" class="tableflat">
		                                </td>
		                                <td>
		                                	${model_index+1}
		                                </td>
		                                <td>
		                                	<#if model.code?exists>
		                                		${model.code}
		                                	</#if>
		                                </td>
		                                <td>
		                                	<#if model.title?exists>
		                                		${model.title}
		                                	</#if>
		                                </td>
		                                <td>
		                                	<#if model.username?exists>
		                                		${model.username}
		                                	</#if>
		                                </td>
		                                <td>
		                                	<#if model.changeUsername?exists>
		                                		${model.changeUsername}
		                                	</#if>
		                                </td>
		                                <td>
		                                	<#if model.status?exists>
		                                		<#if model.status=="Y">
		                                			已完成
		                                		<#elseif model.status=="T">
		                                			转让中
		                                		<#elseif model.status=="N">
		                                			已取消
		                                		<#elseif model.status=="C">	
		                                		           待审核
		                                		</#if>
		                               		</#if>
		                                </td>		                                
		                                <td>
		                                	<#if model.min?exists>
		                                		<#if (model.min != 0 )>
			                                		${model.min?string('#.00')}
			                                	<#else>
			                                	 	${model.min?string('0.00')}
			                                	</#if>
		                                	</#if>
		                                </td>		                                		                                
		                                <td>
		                                	<#if model.amount?exists>
		                                		${model.amount}
		                                	</#if>
		                                </td>
		                                <td>
		                                	<#if model.validDay?exists>
		                                		${model.validDay}
		                                	</#if>
		                                </td>								
		                                <td>
		                                	<#if model.createTime?exists>
		                                		${(model.createTime?string("yyyy-MM-dd HH:mm:ss"))}	   
		                                	</#if>                             	
		                                </td>
		                                 <td>
		                                 	<#if model.status=="C">
		                                 		<a class="changeBtn" data-id="${model.id }">审核转账</a>
		                                 	<#elseif model.status=="Y">	
		                                 		<a href="/admin/borrow/changeRecord/list?changeId=${model.id}">查看购买记录</a>	
		                                 	</#if>
		                                 		                                 
		                                </td>
		                             </tr>   
		                        </#list>
		                    <#else>
								<tr class="even pointer">
									<td colspan="15">无记录</td>
								</tr>
							</#if>
                        </tbody>
                    </table>
                    <#if (pageInfo.pageList?size > 0)>
	                	<#include "../base/Page.ftl">
	                </#if>
                </div>
            </div>
        </div>
        <br />
        <br />
        <br />
    </div>
</div>

<script src="${_js}/bootstrap.min.js"></script>

<!-- bootstrap progress js -->
<script src="${_js}/progressbar/bootstrap-progressbar.min.js" type="text/javascript"></script>
<script src="${_js}/nicescroll/jquery.nicescroll.min.js" type="text/javascript"></script>
<!-- icheck -->
<script src="${_js}/icheck/icheck.min.js" type="text/javascript"></script>

<script src="${_js}/custom.js" type="text/javascript"></script>

<script type="text/javascript" src="${_front_js}/layer/layer.js" ></script>
<script type="text/javascript" src="${_front_js}/layer/extend/layer.ext.js" ></script>

<script>
    $(document).ready(function () {
        $('input.tableflat').iCheck({
            checkboxClass: 'icheckbox_flat-green',
            radioClass: 'iradio_flat-green'
        });
    });
    
    function initData(action) { 
		window.location.href=action;
	} 
	
	$(".btn-info").click(function(){
		initData($("#example").attr('data-action'));
	});
	
	function createXMLHTTPRequest() {     
         //1.创建XMLHttpRequest对象     
         //这是XMLHttpReuquest对象无部使用中最复杂的一步     
         //需要针对IE和其他类型的浏览器建立这个对象的不同方式写不同的代码     
         var xmlHttpRequest;  
         if (window.XMLHttpRequest) {     
             //针对FireFox，Mozillar，Opera，Safari，IE7，IE8     
            xmlHttpRequest = new XMLHttpRequest();     
             //针对某些特定版本的mozillar浏览器的BUG进行修正     
             if (xmlHttpRequest.overrideMimeType) {     
                 xmlHttpRequest.overrideMimeType("text/xml");     
             }     
         } else if (window.ActiveXObject) {     
             //针对IE6，IE5.5，IE5     
             //两个可以用于创建XMLHTTPRequest对象的控件名称，保存在一个js的数组中     
             //排在前面的版本较新     
             var activexName = [ "MSXML2.XMLHTTP", "Microsoft.XMLHTTP" ];     
             for ( var i = 0; i < activexName.length; i++) {     
                 try {     
                     //取出一个控件名进行创建，如果创建成功就终止循环     
                     //如果创建失败，回抛出异常，然后可以继续循环，继续尝试创建     
                    xmlHttpRequest = new ActiveXObject(activexName[i]);   
                    if(xmlHttpRequest){  
                        break;  
                    }  
                 } catch (e) {     
                 }     
             }     
         }     
         return xmlHttpRequest;  
     }  
                     
        $(".changeBtn").click(function(){
        	var id=$(this).attr("data-id");
        	if(confirm('你确定要进行审核转账吗 ？')){
        		var index = layer.load(1,{shade: [0.8, '#393D49']});
		             
				var req = createXMLHTTPRequest();  
				    if(req){  
				        req.open("POST", "/hf/change/transfer", true);  
				        req.setRequestHeader("Content-Type","application/x-www-form-urlencoded; charset=UTF-8;");     
				        req.send("cid="+id);  
				        req.onreadystatechange = function(){  
				            if(req.readyState == 4){  
				                if(req.status == 200){  
				                    alert("操作成功");
				                }else{  
				                    alert("操作失败");  
				                }  
			                	layer.close(index);
			                    window.location.reload();  
				            }  
				        }  
				    }  		               
		   }	                  		

        })
</script>
</body>

</html>